﻿<UserControl x:Class="ExORMDesginer.UserControls.CodeGeneratorView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        mc:Ignorable="d"  d:DesignHeight="1024" d:DesignWidth="1280"
         xmlns:editer="clr-namespace:ExORMDesginer.UserControls.CCodeEditer"
        xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" Loaded="UserControl_Loaded">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../CustomControls/Resources/ListBoxItemStyle.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid x:Name="LeftBar">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="200" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid Grid.Column="0"  >
            <telerik:RadPanelBar x:Name="radPanelBar" VerticalAlignment="Stretch" 
					BorderBrush="#FFCBD8E8" BorderThickness="0.6" IsManipulationEnabled="True" IsOptionElementsEnabled="True" IsDragTooltipEnabled="False" IsDragPreviewEnabled="False" IsDropPreviewLineEnabled="False" ExpandMode="Multiple">
                <telerik:RadPanelBarItem IsExpanded="True" >
                    <telerik:RadPanelBarItem.Header>
                        <TextBlock Text="自定义模版" Margin="5 3" />
                    
                    </telerik:RadPanelBarItem.Header>
                    <ListBox ItemsSource="{Binding Model.TemplateList}" SelectedItem="{Binding SelectTemplate}">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Name}"></TextBlock>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </telerik:RadPanelBarItem>
                <telerik:RadPanelBarItem IsExpanded="True">
                    <telerik:RadPanelBarItem.Header>
                        <TextBlock Text="物理元数据" Margin="5 3" />
                    </telerik:RadPanelBarItem.Header>

                    <ListBox ItemsSource="{Binding DisplayEntities}" SelectedItem="{Binding SelectEntity}" ScrollViewer.CanContentScroll="True">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Name}"></TextBlock>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                    
                </telerik:RadPanelBarItem>
            </telerik:RadPanelBar>
        </Grid>
        <GridSplitter  Background="#FF656565"  Width="0.2" Grid.Column="0"/>
        <Grid Grid.Column="1" Margin="2,0,0,0" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="45"/>
                <ColumnDefinition Width="0.927*"/>
            </Grid.ColumnDefinitions>



            <Border Grid.Column="0" CornerRadius="3" BorderBrush="#FF8D8D8D" BorderThickness="0.7,0.7,0.7,0.7">
                <StackPanel>

                    <Controls:AppBarButton Name="New" Margin="0,8,0,0" Height="45" Width="40" MetroImageSource="{DynamicResource New}" ToolTip="说明:建立新的项目，包括表元数据、数据设计、业务设计、界面生成、代码生成等。"  >
                        <TextBlock Text="新建" FontSize="9"/>
                    </Controls:AppBarButton>
                    <Controls:AppBarButton Name="Open" Margin="0,8,0,0" Height="45" Width="40" MetroImageSource="{DynamicResource Folder}"   ToolTip="说明:建立新的项目，包括表元数据、数据设计、业务设计、界面生成、代码生成等。" >
                        <TextBlock Text="打开" FontSize="9"/>
                    </Controls:AppBarButton>
                    <Controls:AppBarButton Name="Generator" Margin="0,8,0,0" Height="45" Width="40" MetroImageSource="{DynamicResource Floppy}"   ToolTip="说明:保存项目模型信息到文件系统中。" >
                        <TextBlock Text="生成" FontSize="9"/>
                    </Controls:AppBarButton>
                    <Controls:AppBarButton Margin="0,8,0,0" Height="45" Width="40" MetroImageSource="{DynamicResource Properties}"  ToolTip="说明:系统设置选项。">
                        <TextBlock Text="设置" FontSize="9" />
                    </Controls:AppBarButton>
                    <Border BorderThickness="0.7" BorderBrush="DarkGray" Width="30" Height="1" Margin="0,8,0,0" HorizontalAlignment="Center"/>
              
                </StackPanel>
            </Border>
            <Grid Grid.Column="1">
              
                <GroupBox  BorderThickness="0.3" Margin="7,0,7,7" >
                    <GroupBox.Header>
                        <TextBlock Text="模板编辑/(代码预览)" FontSize="15" Foreground="Azure"/>
                    </GroupBox.Header>
                    <TabControl>
                        <TabItem Header="模板" IsSelected="{Binding TemplateTabSelection}">
                            <editer:CCodeEditer x:Name="templateEditer" Margin="3,5,3,3"  EditerType="CSharp"  Text="{Binding Model.Code}" InitText="{Binding Model.Code,Mode=OneTime}"></editer:CCodeEditer>
                        </TabItem>
                        <TabItem Header="预览" IsSelected="{Binding PreviewTabSelection}">
                            <editer:CCodeEditer x:Name="previewEditer" Margin="3,5,3,3"  EditerType="CSharp"  Text="{Binding Model.Code}" InitText="{Binding Model.Code,Mode=OneTime}"></editer:CCodeEditer>
                        </TabItem>
                    </TabControl>
                   
                </GroupBox>
              
            </Grid>
        </Grid>
    </Grid>
</UserControl>
